﻿<!DOCTYPE html>
<html ng-app="demoApp">
<head>
    <title id="Description">jqxNotification directive for AngularJS</title>
    <link rel="stylesheet" type="text/css" href="../../jqwidgets/styles/jqx.base.css" />
    <script type="text/javascript" src="../../scripts/angular.min.js"></script>
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxinput.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxnotification.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxangular.js"></script>
    <script type="text/javascript" src="../../scripts/demos.js"></script>
    <script type="text/javascript">
        var demoApp = angular.module("demoApp", ["jqwidgets"]);
        demoApp.controller("demoController", function ($scope) {
            $scope.notifications =
            [
                {
                    name: "Ken",
                    about: "Appointment",
                    message: "Just wanted to remind you dinner is at 8pm tonight at Carl's."
                },
                {
                    name: "Sue",
                    about: "Shopping",
                    message: "Here's the shopping list for tommorow's party: Wine, Tomatoes, Cheese, Popcorn"
                }
            ]

            // jqxNotification's settings.
            $scope.notificationSettings = {
                width: "auto", position: "top-right", opacity: 0.9, 
                closeOnClick: true, autoClose: false, showCloseButton: true, template: "mail"//, blink: true
            }

            // open notification.
            $scope.checkMail = function () {
                $scope.notificationSettings.apply('open');
            }

            $scope.showMails = function () {
                $scope.showAllMails = true;
            }
        });
    </script>
</head>
<body>
    <div ng-controller="demoController">
        <jqx-notification jqx-on-click="showMails()" jqx-settings="notificationSettings">
            <div>
                You have <b>{{notifications.length}}</b> new messages.
            </div>
            <div style="font-size: smaller; text-align: center;">
                Click to view.
            </div>
        </jqx-notification>
        <jqx-button jqx-on-click="checkMail()">
            Check mail</jqx-button>
        <div id="messagePanel" ng-show="showAllMails" style="width: 400px;">
            <div ng-repeat="notification in notifications">
                <p>
                    <b>From:</b> {{notification.name}}
                </p>
                <p>
                    <b>About</b>: {{notification.about}}
                </p>
                <p>
                    {{notification.message}}
                </p>
            </div>
        </div>
    </div>
</body>
</html>
